﻿-var entity = ViewData["entity"] as NotarialForm
-var statuses = ViewData["statuses"] as IList<NotarialFormStatus>
-bool popup = ViewData.ContainsKey("popup")
%form.validate{action="notarialform.ivp/save",method="post"}
  _formfields
  =HTMLHelper.HiddenInput("id",entity.Id)
  #content{class=(popup?"popup":"")}
    .formheader
      %h1
        %img.icon24{src="img/headericons/orderform.png"}
          %span=string.Format("Бланк № {0} - {1}", entity.NotarialFormSerialNumber.Name, entity.FullName)
      .field  
        %label.required{for="statusid"}Статус  
        =HTMLHelper.Select("statusid", statuses, "name", "id", entity.StatusId, "px200 required")
      %div{class=string.Format("field {0}", (entity.IsInvalid) ? "" : "hidden")}
        %label{for="modifydate"}Комментарий к испорченному бланку
        %textarea#comment.width100.autogrow{name="comment", maxlength="1000"}=entity.Comment
      .field
        %label{for="createdate"}Дата создания
        %input#createdate.px200.basictext.disabled{name="date", value=entity.CreateDate.ToDateString(), disabled="true"}
      .field
        %label{for="modifydate"}Дата изменения
        %input#modifydate.px200.basictext.disabled{name="modifydate", value=entity.ModifyDate.ToDateString(), disabled="true"}
      -if (entity.IsFinished)
        .field
          %label{for="enddate"}Дата выдачи
          %input#enddate.px200.basictext.disabled{name="enddate", value=entity.EndDate.ToDateString(), disabled="true"}
      %table
        %tr
          %td
            .field
              %label.radio{for="isinact"}
                =HTMLHelper.Checkbox("isinact","True","",entity.IsInAct)
                ="Учтен в акте"
          %td
            .field
              %label.radio{for="isinenot"}
                =HTMLHelper.Checkbox("isinenot","True","",entity.IsInEnot)
                ="Экспортирован в еНот"  
    _error
    .formbody
    .formbottom
      %div
        -if (!popup)       
          %button.saveandreturn#submit{type="submit",onclick="$('#returnaftersave').val('true')"} Сохранить и вернуться
          %button.save#submit{type="submit",onclick="$('#returnaftersave').val('')"} Сохранить
          %button.return{type="button",onclick="closeForm();"} Вернуться
        -else
          %button.return{type="button",onclick="closeForm('close');"} Закрыть

        
